package com.spa.interfaces.shop;

import com.spa.application.dto.shop.BusinessDataDTO;
import com.spa.application.query.shop.BusinessDataQuery;
import com.spa.application.service.shop.ShopBusinessDataService;
import com.spa.infrastructure.common.ResponseMessage;
import com.spa.interfaces.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.ParseException;

@RestController
@RequestMapping("/shop/business")
public class ShopBusinessDataController extends BaseController {

    @Resource
    private ShopBusinessDataService shopBusinessDataService;

    @PostMapping
    public ResponseMessage<BusinessDataDTO> index(@Validated @RequestBody BusinessDataQuery query) throws ParseException {
        return responseHelper.success(shopBusinessDataService.index(query));
    }
}
